<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <th:block th:include="MainInterface/include :: common-css" />

</head>

<body class="fixed-left">
<div id="wrapper">

    <th:block th:include="MainInterface/include :: header-menu(5)" />
        <div class="dialog">
        <form id="bookList">
            <div class="dialog-box">
                <h1>用户编辑</h1>
                <p>
                    ID :
                    <input  name="id" th:value="${usersList.id}" readonly unselectable="on">
                </p>
                <p>用户名 : <input name="name" th:value="${usersList.name}"></p>
                <p>手机号 : <input name="phone" th:value="${usersList.phone}"></p>
                <p>
                    密码 :
                    <input name="password" th:value="${usersList.password}">
                </p>

                <p>性别 :
                    <select name="sex">
                        <option value="0" th:selected="${usersList.sex eq 0}">女</option>
                        <option value="1" th:selected="${usersList.sex eq 1}">男</option>
                    </select>
                </p>
                <p>
                    年龄 :
                    <input name="age" th:value="${usersList.age}">
                </p>
                <div>
                <input style="width: 75px ; height : 50px " type="button" value="修改" onclick="edit()">
                <!--            <button id="book_save" >提交</button>-->
                <button style="width: 75px ; height : 50px "> <a href="/userManage">返回</a></button></div>
            </div>
        </form>
        </div>

    </div>


</body>
<script>
    function edit(){
        // $("#add").show();
        $.ajax({
            type:"post",
            url:"/userManage/saveOrUpdata",
            data:$("#bookList").serialize(),
            async:false,
            dataType: 'json',
            success:function (result) {
                console.log($("#bookList").serialize(),)
                if(result.code==0){
                    window.alert("修改成功");
                    window.location.href="/userManage"
                } else {
                    window.alert(result.msg || "修改失败");
                }

            }
        });
    }
</script>
</html>